﻿var Accept = {
    model: function (d = {}) {
        this.Title = d.Title || "条件确认开关";
        this.Name = d.Name || 'lg' + lg.GetSN(6, 10);
        this.ExportName = d.ExportName || "";
        this.Width = d.Width || "100%";
        this.Required = d.Required || false;
        this.IsRender = d.IsRender != undefined ? d.IsRender : true;
        this.IsShow = d.IsShow || false;
        this.IsExport = d.IsExport || false;
        this.IsWhere = d.IsWhere || false;
        this.WhereKey = d.WhereKey || "精确匹配"
    },
    component: {
        name: "lg-form-accept",
        data: {
            props: {
                items: {
                    type: Array,
                    default: []
                },
                value: {
                    type: [String, Boolean],
                    default: false
                },
                data: {
                    type: Object,
                    default: {}
                },
                //0填写 1查看
                renderType: {
                    type: Number,
                    default: 0
                }
            },
            methods: {
                onCheck: function () {
                    console.log("onCheck")
                    this.$emit("update:value", !this.value)
                    this.$emit('done', this.data.Name, !this.value)
                }
            },
            template: `
            <div :class="['lg-form-item',{'lg-ver-error':data.error},{'pointer-none':renderType==1}]" :style="{'width':data.Width}">
                <div :class="['lg-form-check','lg-form-switch-check',{'lg-checked':value},{'pointer-none':renderType==1}]" v-on:click="onCheck">
						 	<i class="lg-form-check-icon"></i>
						    <span>{{data.Title}}</span>
				</div>
            </div>`

        }
    }
}


export { Accept }